package priv.pront.code.national.acwing.dp.bags;

import java.util.Scanner;

public class Acwing1021_货币系统 {

    static int[] v;
    static long[] dp;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        v  = new int[n + 1];
        dp = new long[m + 1];
        for(int i = 1; i <= n; i++){v[i] = scanner.nextInt();}
        dp[0] = 1;
        for(int i = 1; i <= n; i++){
            for(int j = v[i]; j <= m; j++){
                dp[j] += dp[j - v[i]];
            }
        }
        System.out.println(dp[m]);
    }
}
